Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PublicationDistribution from pulpcore.plugin #219

Merged
merged 1 commit into from
May 10, 2019
Merged

Use PublicationDistribution from pulpcore.plugin #219

merged 1 commit into from
May 10, 2019

Conversation

bmbouter
Copy link
Member

@bmbouter bmbouter commented May 9, 2019

The plugin API now uses PublicationDistribution which causes pulp_file
users to only receive the fields they can actually use.

Required PR: pulp/pulpcore#124
Required PR: pulp/pulpcore-plugin#97

https://pulp.plan.io/issues/4785
closes #4785

bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. Each receives
a viewset, serializer, and filterset to match. Each also is a full
Detail model and can be used by plugins without additional code from
them.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
@bmbouter bmbouter changed the title Use PublicationDistribtion from core Use PublicationDistribution from pulpcore.plugin May 9, 2019
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
bmbouter pushed a commit to bmbouter/pulpcore-plugin that referenced this pull request May 9, 2019
Model Changes

The Distribution model was replaced with the
RepositoryVersionDistribution and PublicationDistribution models. These
are both abstract models and are meant to be subclassed further.

Serializer Changes

The DistributionSerializer is removed and now
BaseDistributionSerializer, PublicationDistributionSerializer, and
RepositoryVersionDistributionSerializer are here. These can also be
further subclassed by plugin writers.

ViewSet Changes

DistributionViewset is now called BaseDistributionViewSet. No other
viewsets are provided.

Required PR: pulp/pulpcore#124
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes #4785
bmbouter pushed a commit to bmbouter/pulpcore-plugin that referenced this pull request May 9, 2019
Model Changes

The Distribution model was replaced with the
RepositoryVersionDistribution and PublicationDistribution models. These
are both abstract models and are meant to be subclassed further.

Serializer Changes

The DistributionSerializer is removed and now
BaseDistributionSerializer, PublicationDistributionSerializer, and
RepositoryVersionDistributionSerializer are here. These can also be
further subclassed by plugin writers.

ViewSet Changes

DistributionViewset is now called BaseDistributionViewSet. No other
viewsets are provided.

Docs Changes

The release notes are updated to indicate the breaking changes.

Required PR: pulp/pulpcore#124
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes #4785
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

This also adds a release note about the breaking changes that come with
the switch to Master/Detail.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
@pep8speaks
Copy link

pep8speaks commented May 9, 2019

Hello @bmbouter! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-05-10 16:18:24 UTC

bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

This also adds a release note about the breaking changes that come with
the switch to Master/Detail.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

This also adds a release note about the breaking changes that come with
the switch to Master/Detail.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

This also adds a release note about the breaking changes that come with
the switch to Master/Detail.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 9, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

This also adds a release note about the breaking changes that come with
the switch to Master/Detail.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
bmbouter pushed a commit to bmbouter/pulpcore-plugin that referenced this pull request May 9, 2019
Model Changes

The Distribution model was replaced with the
RepositoryVersionDistribution and PublicationDistribution models. These
are both abstract models and are meant to be subclassed further.

Serializer Changes

The DistributionSerializer is removed and now
BaseDistributionSerializer, PublicationDistributionSerializer, and
RepositoryVersionDistributionSerializer are here. These can also be
further subclassed by plugin writers.

ViewSet Changes

DistributionViewset is now called BaseDistributionViewSet. No other
viewsets are provided.

Docs Changes

The release notes are updated to indicate the breaking changes.

Required PR: pulp/pulpcore#124
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes #4785
@@ -81,22 +81,31 @@ class FilePublicationSerializer(PublicationSerializer):
Serializer for File Publications.
"""

_file_distributions = DetailRelatedField(
Copy link
Contributor

@gmbnomis gmbnomis May 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about just using the default relation name (i.e. no need for default_related_name) and make the field available at _distributions in the serializer:

    _distributions = RelatedField(
        help_text=_(
            "This publication is currently being served as defined by these distributions."
        ),
        source="filedistribution_set",
        many=True,
        read_only=True,
        view_name="distributions-file/file-detail",
    )

As an alternative we could use a DetailRelatedField. It is simpler to use, although not really necessary in this case, since we don't need to support subclasses of FileDistribution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a plugin defined field, should we drop the underscore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Does a convention that should be implemented the same in all plugins make the field a "core field"? (we had a slightly similar discussion on _artifact once, IIRC). I am fine either way and slightly preferring to drop the underscore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the feedback I think the best thing to do is to switch this to be distributions. That both makes it a core variable and also brings more consistency with the hope that more plugins will do the same. Does this sound right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, PR looks good to me now

The plugin API now uses PublicationDistribution which causes pulp_file
users to only receive the fields they can actually use.

Required PR: pulp/pulpcore#124
Required PR: pulp/pulpcore-plugin#97

https://pulp.plan.io/issues/4785
closes #4785
bmbouter pushed a commit to bmbouter/pulpcore that referenced this pull request May 10, 2019
The Distribution contained options which should not be mixed.
Specifically the repository and repository_version options go together
and the publication goes by itself.

This PR splits that object into two new objects
RepositoryVersionDistribution and PublicationDistribution. The two
models are not detail objects, and require the plugin writer to declare
a Distribution detail object. It was already this way before this PR.

This also adds a release note about the breaking changes that come with
the switch to Master/Detail.

Required PR: pulp/pulpcore-plugin#97
Required PR: pulp/pulp_file#219

https://pulp.plan.io/issues/4785
closes pulp#4785
@bmbouter bmbouter merged commit 88f5bd3 into pulp:master May 10, 2019
@bmbouter bmbouter deleted the split-distribution branch May 10, 2019 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants